#ifndef RUNTHREAD_H
#define RUNTHREAD_H

#include <QThread>
#include <QProcess>
#include "headers/mainwindow.h"
class MainWindow;

class RunThread : public QThread
{
    Q_OBJECT
    QProcess *proc;
    QString prog;
    QString dir;
    QStringList arglist;
    MainWindow* wnd;
public:
    explicit RunThread(QObject *parent = 0);
    void	run ();
    QProcess* getProc(){return proc;}
    void setWindow(MainWindow* w){wnd =w;}
    bool isCmdRunning();
signals:
    
public slots:
    void read();
    void setProg(QString& p);
    void setDir(QString& d);
    void addArg(QString& ag);
    void reset();
    void onFinish(int ec);
    //void onState(QProcess::ProcessState);
    void onReadStd();
    void onReadChannel();
    void onError(QProcess::ProcessError er);
};

#endif // RUNTHREAD_H
